#include "stdafx.h"
#ifdef BZSLIB_WINKERNEL
#ifdef _DEBUG

#include "ioctldbg.h"

/*  The switch-case block inside the next routine and the include block were generated from Windows XP DDK
	include files using the following PERL script:

	open INC, ">inc.h";

	foreach(<STDIN>)
	{
	chomp;
	open F, $_;
	$cnt = 0;
	$fn = $_;
	foreach (<F>)
		{
		chomp;
		if (/#define[ \t]+(IOCTL_[^ ]+)[ \t]+CTL_CODE/)
			{
			print "    case $1:\n        return \"$1\";\n";
			$cnt++;
			}
		}
	print INC "#include <$fn>\n" if $cnt;
	close F;
	}

*/

extern "C" {
#include <ntddk.h>
#include <d4iface.h>
#include <d4drvif.h>
#include <kbdmou.h>
#include <mountdev.h>
#include <mountmgr.h>
#include <ntdd1394.h>
#include <ntdd8042.h>
#include <ntddbeep.h>
#include <ntddcdrm.h>
#include <ntddcdvd.h>
#include <ntddchgr.h>
#include <ntdddisk.h>
#include <ntddkbd.h>
#include <ntddmou.h>
#include <ntddpcm.h>
#include <ntddscsi.h>
#include <ntddsd.h>
#include <ntddser.h>
#include <ntddstor.h>
#include <ntddtape.h>
#include <ntddvol.h>
#include <parallel.h>
#include <scsiscan.h>
#include <swenum.h>
#include <usbioctl.h>
#include <usbscan.h>
}

#include <stdio.h>

const char *BazisLib::DDK::MapDeviceControlCode(ULONG Code)
{
	switch (Code)
	{
    case IOCTL_DOT4_CREATE_SOCKET:
        return "IOCTL_DOT4_CREATE_SOCKET";
    case IOCTL_DOT4_DESTROY_SOCKET:
        return "IOCTL_DOT4_DESTROY_SOCKET";
    case IOCTL_DOT4_WAIT_FOR_CHANNEL:
        return "IOCTL_DOT4_WAIT_FOR_CHANNEL";
    case IOCTL_DOT4_OPEN_CHANNEL:
        return "IOCTL_DOT4_OPEN_CHANNEL";
    case IOCTL_DOT4_CLOSE_CHANNEL:
        return "IOCTL_DOT4_CLOSE_CHANNEL";
    case IOCTL_DOT4_READ:
        return "IOCTL_DOT4_READ";
    case IOCTL_DOT4_WRITE:
        return "IOCTL_DOT4_WRITE";
    case IOCTL_DOT4_ADD_ACTIVITY_BROADCAST:
        return "IOCTL_DOT4_ADD_ACTIVITY_BROADCAST";
    case IOCTL_DOT4_REMOVE_ACTIVITY_BROADCAST:
        return "IOCTL_DOT4_REMOVE_ACTIVITY_BROADCAST";
    case IOCTL_DOT4_WAIT_ACTIVITY_BROADCAST:
        return "IOCTL_DOT4_WAIT_ACTIVITY_BROADCAST";
    case IOCTL_INTERNAL_KEYBOARD_CONNECT:
        return "IOCTL_INTERNAL_KEYBOARD_CONNECT";
    case IOCTL_INTERNAL_KEYBOARD_DISCONNECT:
        return "IOCTL_INTERNAL_KEYBOARD_DISCONNECT";
    case IOCTL_INTERNAL_KEYBOARD_ENABLE:
        return "IOCTL_INTERNAL_KEYBOARD_ENABLE";
    case IOCTL_INTERNAL_KEYBOARD_DISABLE:
        return "IOCTL_INTERNAL_KEYBOARD_DISABLE";
    case IOCTL_INTERNAL_MOUSE_CONNECT:
        return "IOCTL_INTERNAL_MOUSE_CONNECT";
    case IOCTL_INTERNAL_MOUSE_DISCONNECT:
        return "IOCTL_INTERNAL_MOUSE_DISCONNECT";
    case IOCTL_INTERNAL_MOUSE_ENABLE:
        return "IOCTL_INTERNAL_MOUSE_ENABLE";
    case IOCTL_INTERNAL_MOUSE_DISABLE:
        return "IOCTL_INTERNAL_MOUSE_DISABLE";
    case IOCTL_MOUNTDEV_QUERY_UNIQUE_ID:
        return "IOCTL_MOUNTDEV_QUERY_UNIQUE_ID";
    case IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME:
        return "IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME";
    case IOCTL_MOUNTDEV_LINK_CREATED:
        return "IOCTL_MOUNTDEV_LINK_CREATED";
    case IOCTL_MOUNTDEV_LINK_DELETED:
        return "IOCTL_MOUNTDEV_LINK_DELETED";
    case IOCTL_MOUNTDEV_QUERY_STABLE_GUID:
        return "IOCTL_MOUNTDEV_QUERY_STABLE_GUID";
    case IOCTL_MOUNTMGR_CREATE_POINT:
        return "IOCTL_MOUNTMGR_CREATE_POINT";
    case IOCTL_MOUNTMGR_DELETE_POINTS:
        return "IOCTL_MOUNTMGR_DELETE_POINTS";
    case IOCTL_MOUNTMGR_QUERY_POINTS:
        return "IOCTL_MOUNTMGR_QUERY_POINTS";
    case IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY:
        return "IOCTL_MOUNTMGR_DELETE_POINTS_DBONLY";
    case IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER:
        return "IOCTL_MOUNTMGR_NEXT_DRIVE_LETTER";
    case IOCTL_MOUNTMGR_AUTO_DL_ASSIGNMENTS:
        return "IOCTL_MOUNTMGR_AUTO_DL_ASSIGNMENTS";
    case IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED:
        return "IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED";
    case IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED:
        return "IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED";
    case IOCTL_MOUNTMGR_CHANGE_NOTIFY:
        return "IOCTL_MOUNTMGR_CHANGE_NOTIFY";
    case IOCTL_MOUNTMGR_KEEP_LINKS_WHEN_OFFLINE:
        return "IOCTL_MOUNTMGR_KEEP_LINKS_WHEN_OFFLINE";
    case IOCTL_MOUNTMGR_CHECK_UNPROCESSED_VOLUMES:
        return "IOCTL_MOUNTMGR_CHECK_UNPROCESSED_VOLUMES";
    case IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION:
        return "IOCTL_MOUNTMGR_VOLUME_ARRIVAL_NOTIFICATION";
    case IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH:
        return "IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATH";
    case IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS:
        return "IOCTL_MOUNTMGR_QUERY_DOS_VOLUME_PATHS";
    case IOCTL_MOUNTDEV_QUERY_DEVICE_NAME:
        return "IOCTL_MOUNTDEV_QUERY_DEVICE_NAME";
    case IOCTL_IEEE1394_API_REQUEST:
        return "IOCTL_IEEE1394_API_REQUEST";
    case IOCTL_INTERNAL_I8042_HOOK_KEYBOARD:
        return "IOCTL_INTERNAL_I8042_HOOK_KEYBOARD";
    case IOCTL_INTERNAL_I8042_HOOK_MOUSE:
        return "IOCTL_INTERNAL_I8042_HOOK_MOUSE";
    case IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER:
        return "IOCTL_INTERNAL_I8042_KEYBOARD_WRITE_BUFFER";
    case IOCTL_INTERNAL_I8042_MOUSE_WRITE_BUFFER:
        return "IOCTL_INTERNAL_I8042_MOUSE_WRITE_BUFFER";
    case IOCTL_INTERNAL_I8042_CONTROLLER_WRITE_BUFFER:
        return "IOCTL_INTERNAL_I8042_CONTROLLER_WRITE_BUFFER";
    case IOCTL_INTERNAL_I8042_KEYBOARD_START_INFORMATION:
        return "IOCTL_INTERNAL_I8042_KEYBOARD_START_INFORMATION";
    case IOCTL_INTERNAL_I8042_MOUSE_START_INFORMATION:
        return "IOCTL_INTERNAL_I8042_MOUSE_START_INFORMATION";
    case IOCTL_BEEP_SET:
        return "IOCTL_BEEP_SET";
    case IOCTL_CDROM_UNLOAD_DRIVER:
        return "IOCTL_CDROM_UNLOAD_DRIVER";
    case IOCTL_CDROM_READ_TOC:
        return "IOCTL_CDROM_READ_TOC";
    case IOCTL_CDROM_SEEK_AUDIO_MSF:
        return "IOCTL_CDROM_SEEK_AUDIO_MSF";
    case IOCTL_CDROM_STOP_AUDIO:
        return "IOCTL_CDROM_STOP_AUDIO";
    case IOCTL_CDROM_PAUSE_AUDIO:
        return "IOCTL_CDROM_PAUSE_AUDIO";
    case IOCTL_CDROM_RESUME_AUDIO:
        return "IOCTL_CDROM_RESUME_AUDIO";
    case IOCTL_CDROM_GET_VOLUME:
        return "IOCTL_CDROM_GET_VOLUME";
    case IOCTL_CDROM_PLAY_AUDIO_MSF:
        return "IOCTL_CDROM_PLAY_AUDIO_MSF";
    case IOCTL_CDROM_SET_VOLUME:
        return "IOCTL_CDROM_SET_VOLUME";
    case IOCTL_CDROM_READ_Q_CHANNEL:
        return "IOCTL_CDROM_READ_Q_CHANNEL";
    case IOCTL_CDROM_GET_LAST_SESSION:
        return "IOCTL_CDROM_GET_LAST_SESSION";
    case IOCTL_CDROM_RAW_READ:
        return "IOCTL_CDROM_RAW_READ";
    case IOCTL_CDROM_DISK_TYPE:
        return "IOCTL_CDROM_DISK_TYPE";
    case IOCTL_CDROM_GET_DRIVE_GEOMETRY:
        return "IOCTL_CDROM_GET_DRIVE_GEOMETRY";
    case IOCTL_CDROM_GET_DRIVE_GEOMETRY_EX:
        return "IOCTL_CDROM_GET_DRIVE_GEOMETRY_EX";
    case IOCTL_CDROM_READ_TOC_EX:
        return "IOCTL_CDROM_READ_TOC_EX";
    case IOCTL_CDROM_GET_CONFIGURATION:
        return "IOCTL_CDROM_GET_CONFIGURATION";
    case IOCTL_CDROM_CHECK_VERIFY:
        return "IOCTL_CDROM_CHECK_VERIFY";
    case IOCTL_CDROM_MEDIA_REMOVAL:
        return "IOCTL_CDROM_MEDIA_REMOVAL";
    case IOCTL_CDROM_EJECT_MEDIA:
        return "IOCTL_CDROM_EJECT_MEDIA";
    case IOCTL_CDROM_LOAD_MEDIA:
        return "IOCTL_CDROM_LOAD_MEDIA";
    case IOCTL_CDROM_RESERVE:
        return "IOCTL_CDROM_RESERVE";
    case IOCTL_CDROM_RELEASE:
        return "IOCTL_CDROM_RELEASE";
    case IOCTL_CDROM_FIND_NEW_DEVICES:
        return "IOCTL_CDROM_FIND_NEW_DEVICES";
    case IOCTL_DVD_START_SESSION:
        return "IOCTL_DVD_START_SESSION";
    case IOCTL_DVD_READ_KEY:
        return "IOCTL_DVD_READ_KEY";
    case IOCTL_DVD_SEND_KEY:
        return "IOCTL_DVD_SEND_KEY";
    case IOCTL_DVD_END_SESSION:
        return "IOCTL_DVD_END_SESSION";
    case IOCTL_DVD_SET_READ_AHEAD:
        return "IOCTL_DVD_SET_READ_AHEAD";
    case IOCTL_DVD_GET_REGION:
        return "IOCTL_DVD_GET_REGION";
    case IOCTL_DVD_SEND_KEY2:
        return "IOCTL_DVD_SEND_KEY2";
    case IOCTL_DVD_READ_STRUCTURE:
        return "IOCTL_DVD_READ_STRUCTURE";
    case IOCTL_STORAGE_SET_READ_AHEAD:
        return "IOCTL_STORAGE_SET_READ_AHEAD";
    case IOCTL_CHANGER_GET_PARAMETERS:
        return "IOCTL_CHANGER_GET_PARAMETERS";
    case IOCTL_CHANGER_GET_STATUS:
        return "IOCTL_CHANGER_GET_STATUS";
    case IOCTL_CHANGER_GET_PRODUCT_DATA:
        return "IOCTL_CHANGER_GET_PRODUCT_DATA";
    case IOCTL_CHANGER_SET_ACCESS:
        return "IOCTL_CHANGER_SET_ACCESS";
    case IOCTL_CHANGER_GET_ELEMENT_STATUS:
        return "IOCTL_CHANGER_GET_ELEMENT_STATUS";
    case IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS:
        return "IOCTL_CHANGER_INITIALIZE_ELEMENT_STATUS";
    case IOCTL_CHANGER_SET_POSITION:
        return "IOCTL_CHANGER_SET_POSITION";
    case IOCTL_CHANGER_EXCHANGE_MEDIUM:
        return "IOCTL_CHANGER_EXCHANGE_MEDIUM";
    case IOCTL_CHANGER_MOVE_MEDIUM:
        return "IOCTL_CHANGER_MOVE_MEDIUM";
    case IOCTL_CHANGER_REINITIALIZE_TRANSPORT:
        return "IOCTL_CHANGER_REINITIALIZE_TRANSPORT";
    case IOCTL_CHANGER_QUERY_VOLUME_TAGS:
        return "IOCTL_CHANGER_QUERY_VOLUME_TAGS";
    case IOCTL_DISK_GET_DRIVE_GEOMETRY:
        return "IOCTL_DISK_GET_DRIVE_GEOMETRY";
    case IOCTL_DISK_GET_PARTITION_INFO:
        return "IOCTL_DISK_GET_PARTITION_INFO";
    case IOCTL_DISK_SET_PARTITION_INFO:
        return "IOCTL_DISK_SET_PARTITION_INFO";
    case IOCTL_DISK_GET_DRIVE_LAYOUT:
        return "IOCTL_DISK_GET_DRIVE_LAYOUT";
    case IOCTL_DISK_SET_DRIVE_LAYOUT:
        return "IOCTL_DISK_SET_DRIVE_LAYOUT";
    case IOCTL_DISK_VERIFY:
        return "IOCTL_DISK_VERIFY";
    case IOCTL_DISK_FORMAT_TRACKS:
        return "IOCTL_DISK_FORMAT_TRACKS";
    case IOCTL_DISK_REASSIGN_BLOCKS:
        return "IOCTL_DISK_REASSIGN_BLOCKS";
    case IOCTL_DISK_PERFORMANCE:
        return "IOCTL_DISK_PERFORMANCE";
    case IOCTL_DISK_IS_WRITABLE:
        return "IOCTL_DISK_IS_WRITABLE";
    case IOCTL_DISK_LOGGING:
        return "IOCTL_DISK_LOGGING";
    case IOCTL_DISK_FORMAT_TRACKS_EX:
        return "IOCTL_DISK_FORMAT_TRACKS_EX";
    case IOCTL_DISK_HISTOGRAM_STRUCTURE:
        return "IOCTL_DISK_HISTOGRAM_STRUCTURE";
    case IOCTL_DISK_HISTOGRAM_DATA:
        return "IOCTL_DISK_HISTOGRAM_DATA";
    case IOCTL_DISK_HISTOGRAM_RESET:
        return "IOCTL_DISK_HISTOGRAM_RESET";
    case IOCTL_DISK_REQUEST_STRUCTURE:
        return "IOCTL_DISK_REQUEST_STRUCTURE";
    case IOCTL_DISK_REQUEST_DATA:
        return "IOCTL_DISK_REQUEST_DATA";
    case IOCTL_DISK_PERFORMANCE_OFF:
        return "IOCTL_DISK_PERFORMANCE_OFF";
    case IOCTL_DISK_CONTROLLER_NUMBER:
        return "IOCTL_DISK_CONTROLLER_NUMBER";
    case IOCTL_DISK_GET_PARTITION_INFO_EX:
        return "IOCTL_DISK_GET_PARTITION_INFO_EX";
    case IOCTL_DISK_SET_PARTITION_INFO_EX:
        return "IOCTL_DISK_SET_PARTITION_INFO_EX";
    case IOCTL_DISK_GET_DRIVE_LAYOUT_EX:
        return "IOCTL_DISK_GET_DRIVE_LAYOUT_EX";
    case IOCTL_DISK_SET_DRIVE_LAYOUT_EX:
        return "IOCTL_DISK_SET_DRIVE_LAYOUT_EX";
    case IOCTL_DISK_CREATE_DISK:
        return "IOCTL_DISK_CREATE_DISK";
    case IOCTL_DISK_GET_LENGTH_INFO:
        return "IOCTL_DISK_GET_LENGTH_INFO";
    case IOCTL_DISK_GET_DRIVE_GEOMETRY_EX:
        return "IOCTL_DISK_GET_DRIVE_GEOMETRY_EX";
    case IOCTL_DISK_UPDATE_DRIVE_SIZE:
        return "IOCTL_DISK_UPDATE_DRIVE_SIZE";
    case IOCTL_DISK_GROW_PARTITION:
        return "IOCTL_DISK_GROW_PARTITION";
    case IOCTL_DISK_GET_CACHE_INFORMATION:
        return "IOCTL_DISK_GET_CACHE_INFORMATION";
    case IOCTL_DISK_SET_CACHE_INFORMATION:
        return "IOCTL_DISK_SET_CACHE_INFORMATION";
    case IOCTL_DISK_DELETE_DRIVE_LAYOUT:
        return "IOCTL_DISK_DELETE_DRIVE_LAYOUT";
    case IOCTL_DISK_UPDATE_PROPERTIES:
        return "IOCTL_DISK_UPDATE_PROPERTIES";
    case IOCTL_DISK_FORMAT_DRIVE:
        return "IOCTL_DISK_FORMAT_DRIVE";
    case IOCTL_DISK_SENSE_DEVICE:
        return "IOCTL_DISK_SENSE_DEVICE";
    case IOCTL_DISK_INTERNAL_SET_VERIFY:
        return "IOCTL_DISK_INTERNAL_SET_VERIFY";
    case IOCTL_DISK_INTERNAL_CLEAR_VERIFY:
        return "IOCTL_DISK_INTERNAL_CLEAR_VERIFY";
    case IOCTL_DISK_INTERNAL_SET_NOTIFY:
        return "IOCTL_DISK_INTERNAL_SET_NOTIFY";
    case IOCTL_DISK_CHECK_VERIFY:
        return "IOCTL_DISK_CHECK_VERIFY";
    case IOCTL_DISK_MEDIA_REMOVAL:
        return "IOCTL_DISK_MEDIA_REMOVAL";
    case IOCTL_DISK_EJECT_MEDIA:
        return "IOCTL_DISK_EJECT_MEDIA";
    case IOCTL_DISK_LOAD_MEDIA:
        return "IOCTL_DISK_LOAD_MEDIA";
    case IOCTL_DISK_RESERVE:
        return "IOCTL_DISK_RESERVE";
    case IOCTL_DISK_RELEASE:
        return "IOCTL_DISK_RELEASE";
    case IOCTL_DISK_FIND_NEW_DEVICES:
        return "IOCTL_DISK_FIND_NEW_DEVICES";
    case IOCTL_DISK_GET_MEDIA_TYPES:
        return "IOCTL_DISK_GET_MEDIA_TYPES";
    case IOCTL_DISK_SIMBAD:
        return "IOCTL_DISK_SIMBAD";
    case IOCTL_KEYBOARD_QUERY_ATTRIBUTES:
        return "IOCTL_KEYBOARD_QUERY_ATTRIBUTES";
    case IOCTL_KEYBOARD_SET_TYPEMATIC:
        return "IOCTL_KEYBOARD_SET_TYPEMATIC";
    case IOCTL_KEYBOARD_SET_INDICATORS:
        return "IOCTL_KEYBOARD_SET_INDICATORS";
    case IOCTL_KEYBOARD_QUERY_TYPEMATIC:
        return "IOCTL_KEYBOARD_QUERY_TYPEMATIC";
    case IOCTL_KEYBOARD_QUERY_INDICATORS:
        return "IOCTL_KEYBOARD_QUERY_INDICATORS";
    case IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION:
        return "IOCTL_KEYBOARD_QUERY_INDICATOR_TRANSLATION";
    case IOCTL_KEYBOARD_INSERT_DATA:
        return "IOCTL_KEYBOARD_INSERT_DATA";
    case IOCTL_KEYBOARD_QUERY_IME_STATUS:
        return "IOCTL_KEYBOARD_QUERY_IME_STATUS";
    case IOCTL_KEYBOARD_SET_IME_STATUS:
        return "IOCTL_KEYBOARD_SET_IME_STATUS";
    case IOCTL_MOUSE_QUERY_ATTRIBUTES:
        return "IOCTL_MOUSE_QUERY_ATTRIBUTES";
    case IOCTL_MOUSE_INSERT_DATA:
        return "IOCTL_MOUSE_INSERT_DATA";
    case IOCTL_GET_TUPLE_DATA:
        return "IOCTL_GET_TUPLE_DATA";
    case IOCTL_SOCKET_INFORMATION:
        return "IOCTL_SOCKET_INFORMATION";
    case IOCTL_SCSI_PASS_THROUGH:
        return "IOCTL_SCSI_PASS_THROUGH";
    case IOCTL_SCSI_MINIPORT:
        return "IOCTL_SCSI_MINIPORT";
    case IOCTL_SCSI_GET_INQUIRY_DATA:
        return "IOCTL_SCSI_GET_INQUIRY_DATA";
    case IOCTL_SCSI_GET_CAPABILITIES:
        return "IOCTL_SCSI_GET_CAPABILITIES";
    case IOCTL_SCSI_PASS_THROUGH_DIRECT:
        return "IOCTL_SCSI_PASS_THROUGH_DIRECT";
    case IOCTL_SCSI_GET_ADDRESS:
        return "IOCTL_SCSI_GET_ADDRESS";
    case IOCTL_SCSI_RESCAN_BUS:
        return "IOCTL_SCSI_RESCAN_BUS";
    case IOCTL_SCSI_GET_DUMP_POINTERS:
        return "IOCTL_SCSI_GET_DUMP_POINTERS";
    case IOCTL_SCSI_FREE_DUMP_POINTERS:
        return "IOCTL_SCSI_FREE_DUMP_POINTERS";
    case IOCTL_IDE_PASS_THROUGH:
        return "IOCTL_IDE_PASS_THROUGH";
    case IOCTL_SD_SUBMIT_REQUEST:
        return "IOCTL_SD_SUBMIT_REQUEST";
    case IOCTL_SERIAL_SET_BAUD_RATE:
        return "IOCTL_SERIAL_SET_BAUD_RATE";
    case IOCTL_SERIAL_SET_QUEUE_SIZE:
        return "IOCTL_SERIAL_SET_QUEUE_SIZE";
    case IOCTL_SERIAL_SET_LINE_CONTROL:
        return "IOCTL_SERIAL_SET_LINE_CONTROL";
    case IOCTL_SERIAL_SET_BREAK_ON:
        return "IOCTL_SERIAL_SET_BREAK_ON";
    case IOCTL_SERIAL_SET_BREAK_OFF:
        return "IOCTL_SERIAL_SET_BREAK_OFF";
    case IOCTL_SERIAL_IMMEDIATE_CHAR:
        return "IOCTL_SERIAL_IMMEDIATE_CHAR";
    case IOCTL_SERIAL_SET_TIMEOUTS:
        return "IOCTL_SERIAL_SET_TIMEOUTS";
    case IOCTL_SERIAL_GET_TIMEOUTS:
        return "IOCTL_SERIAL_GET_TIMEOUTS";
    case IOCTL_SERIAL_SET_DTR:
        return "IOCTL_SERIAL_SET_DTR";
    case IOCTL_SERIAL_CLR_DTR:
        return "IOCTL_SERIAL_CLR_DTR";
    case IOCTL_SERIAL_RESET_DEVICE:
        return "IOCTL_SERIAL_RESET_DEVICE";
    case IOCTL_SERIAL_SET_RTS:
        return "IOCTL_SERIAL_SET_RTS";
    case IOCTL_SERIAL_CLR_RTS:
        return "IOCTL_SERIAL_CLR_RTS";
    case IOCTL_SERIAL_SET_XOFF:
        return "IOCTL_SERIAL_SET_XOFF";
    case IOCTL_SERIAL_SET_XON:
        return "IOCTL_SERIAL_SET_XON";
    case IOCTL_SERIAL_GET_WAIT_MASK:
        return "IOCTL_SERIAL_GET_WAIT_MASK";
    case IOCTL_SERIAL_SET_WAIT_MASK:
        return "IOCTL_SERIAL_SET_WAIT_MASK";
    case IOCTL_SERIAL_WAIT_ON_MASK:
        return "IOCTL_SERIAL_WAIT_ON_MASK";
    case IOCTL_SERIAL_PURGE:
        return "IOCTL_SERIAL_PURGE";
    case IOCTL_SERIAL_GET_BAUD_RATE:
        return "IOCTL_SERIAL_GET_BAUD_RATE";
    case IOCTL_SERIAL_GET_LINE_CONTROL:
        return "IOCTL_SERIAL_GET_LINE_CONTROL";
    case IOCTL_SERIAL_GET_CHARS:
        return "IOCTL_SERIAL_GET_CHARS";
    case IOCTL_SERIAL_SET_CHARS:
        return "IOCTL_SERIAL_SET_CHARS";
    case IOCTL_SERIAL_GET_HANDFLOW:
        return "IOCTL_SERIAL_GET_HANDFLOW";
    case IOCTL_SERIAL_SET_HANDFLOW:
        return "IOCTL_SERIAL_SET_HANDFLOW";
    case IOCTL_SERIAL_GET_MODEMSTATUS:
        return "IOCTL_SERIAL_GET_MODEMSTATUS";
    case IOCTL_SERIAL_GET_COMMSTATUS:
        return "IOCTL_SERIAL_GET_COMMSTATUS";
    case IOCTL_SERIAL_XOFF_COUNTER:
        return "IOCTL_SERIAL_XOFF_COUNTER";
    case IOCTL_SERIAL_GET_PROPERTIES:
        return "IOCTL_SERIAL_GET_PROPERTIES";
    case IOCTL_SERIAL_GET_DTRRTS:
        return "IOCTL_SERIAL_GET_DTRRTS";
    case IOCTL_SERIAL_LSRMST_INSERT:
        return "IOCTL_SERIAL_LSRMST_INSERT";
    case IOCTL_SERENUM_EXPOSE_HARDWARE:
        return "IOCTL_SERENUM_EXPOSE_HARDWARE";
    case IOCTL_SERENUM_REMOVE_HARDWARE:
        return "IOCTL_SERENUM_REMOVE_HARDWARE";
    case IOCTL_SERENUM_PORT_DESC:
        return "IOCTL_SERENUM_PORT_DESC";
    case IOCTL_SERENUM_GET_PORT_NAME:
        return "IOCTL_SERENUM_GET_PORT_NAME";
    case IOCTL_SERIAL_CONFIG_SIZE:
        return "IOCTL_SERIAL_CONFIG_SIZE";
    case IOCTL_SERIAL_GET_COMMCONFIG:
        return "IOCTL_SERIAL_GET_COMMCONFIG";
    case IOCTL_SERIAL_SET_COMMCONFIG:
        return "IOCTL_SERIAL_SET_COMMCONFIG";
    case IOCTL_SERIAL_GET_STATS:
        return "IOCTL_SERIAL_GET_STATS";
    case IOCTL_SERIAL_CLEAR_STATS:
        return "IOCTL_SERIAL_CLEAR_STATS";
    case IOCTL_SERIAL_GET_MODEM_CONTROL:
        return "IOCTL_SERIAL_GET_MODEM_CONTROL";
    case IOCTL_SERIAL_SET_MODEM_CONTROL:
        return "IOCTL_SERIAL_SET_MODEM_CONTROL";
    case IOCTL_SERIAL_SET_FIFO_CONTROL:
        return "IOCTL_SERIAL_SET_FIFO_CONTROL";
    case IOCTL_STORAGE_CHECK_VERIFY:
        return "IOCTL_STORAGE_CHECK_VERIFY";
    case IOCTL_STORAGE_CHECK_VERIFY2:
        return "IOCTL_STORAGE_CHECK_VERIFY2";
    case IOCTL_STORAGE_MEDIA_REMOVAL:
        return "IOCTL_STORAGE_MEDIA_REMOVAL";
    case IOCTL_STORAGE_EJECT_MEDIA:
        return "IOCTL_STORAGE_EJECT_MEDIA";
    case IOCTL_STORAGE_LOAD_MEDIA:
        return "IOCTL_STORAGE_LOAD_MEDIA";
    case IOCTL_STORAGE_LOAD_MEDIA2:
        return "IOCTL_STORAGE_LOAD_MEDIA2";
    case IOCTL_STORAGE_RESERVE:
        return "IOCTL_STORAGE_RESERVE";
    case IOCTL_STORAGE_RELEASE:
        return "IOCTL_STORAGE_RELEASE";
    case IOCTL_STORAGE_FIND_NEW_DEVICES:
        return "IOCTL_STORAGE_FIND_NEW_DEVICES";
    case IOCTL_STORAGE_EJECTION_CONTROL:
        return "IOCTL_STORAGE_EJECTION_CONTROL";
    case IOCTL_STORAGE_MCN_CONTROL:
        return "IOCTL_STORAGE_MCN_CONTROL";
    case IOCTL_STORAGE_GET_MEDIA_TYPES:
        return "IOCTL_STORAGE_GET_MEDIA_TYPES";
    case IOCTL_STORAGE_GET_MEDIA_TYPES_EX:
        return "IOCTL_STORAGE_GET_MEDIA_TYPES_EX";
    case IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER:
        return "IOCTL_STORAGE_GET_MEDIA_SERIAL_NUMBER";
    case IOCTL_STORAGE_GET_HOTPLUG_INFO:
        return "IOCTL_STORAGE_GET_HOTPLUG_INFO";
    case IOCTL_STORAGE_SET_HOTPLUG_INFO:
        return "IOCTL_STORAGE_SET_HOTPLUG_INFO";
    case IOCTL_STORAGE_RESET_BUS:
        return "IOCTL_STORAGE_RESET_BUS";
    case IOCTL_STORAGE_RESET_DEVICE:
        return "IOCTL_STORAGE_RESET_DEVICE";
    case IOCTL_STORAGE_BREAK_RESERVATION:
        return "IOCTL_STORAGE_BREAK_RESERVATION";
    case IOCTL_STORAGE_GET_DEVICE_NUMBER:
        return "IOCTL_STORAGE_GET_DEVICE_NUMBER";
    case IOCTL_STORAGE_PREDICT_FAILURE:
        return "IOCTL_STORAGE_PREDICT_FAILURE";
    case IOCTL_STORAGE_QUERY_PROPERTY:
        return "IOCTL_STORAGE_QUERY_PROPERTY";
    case IOCTL_TAPE_ERASE:
        return "IOCTL_TAPE_ERASE";
    case IOCTL_TAPE_PREPARE:
        return "IOCTL_TAPE_PREPARE";
    case IOCTL_TAPE_WRITE_MARKS:
        return "IOCTL_TAPE_WRITE_MARKS";
    case IOCTL_TAPE_GET_POSITION:
        return "IOCTL_TAPE_GET_POSITION";
    case IOCTL_TAPE_SET_POSITION:
        return "IOCTL_TAPE_SET_POSITION";
    case IOCTL_TAPE_GET_DRIVE_PARAMS:
        return "IOCTL_TAPE_GET_DRIVE_PARAMS";
    case IOCTL_TAPE_SET_DRIVE_PARAMS:
        return "IOCTL_TAPE_SET_DRIVE_PARAMS";
    case IOCTL_TAPE_GET_MEDIA_PARAMS:
        return "IOCTL_TAPE_GET_MEDIA_PARAMS";
    case IOCTL_TAPE_SET_MEDIA_PARAMS:
        return "IOCTL_TAPE_SET_MEDIA_PARAMS";
    case IOCTL_TAPE_GET_STATUS:
        return "IOCTL_TAPE_GET_STATUS";
    case IOCTL_TAPE_CREATE_PARTITION:
        return "IOCTL_TAPE_CREATE_PARTITION";
    case IOCTL_TAPE_MEDIA_REMOVAL:
        return "IOCTL_TAPE_MEDIA_REMOVAL";
    case IOCTL_TAPE_EJECT_MEDIA:
        return "IOCTL_TAPE_EJECT_MEDIA";
    case IOCTL_TAPE_LOAD_MEDIA:
        return "IOCTL_TAPE_LOAD_MEDIA";
    case IOCTL_TAPE_RESERVE:
        return "IOCTL_TAPE_RESERVE";
    case IOCTL_TAPE_RELEASE:
        return "IOCTL_TAPE_RELEASE";
    case IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS:
        return "IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS";
    case IOCTL_VOLUME_IS_CLUSTERED:
        return "IOCTL_VOLUME_IS_CLUSTERED";
    case IOCTL_VOLUME_SUPPORTS_ONLINE_OFFLINE:
        return "IOCTL_VOLUME_SUPPORTS_ONLINE_OFFLINE";
    case IOCTL_VOLUME_ONLINE:
        return "IOCTL_VOLUME_ONLINE";
    case IOCTL_VOLUME_OFFLINE:
        return "IOCTL_VOLUME_OFFLINE";
    case IOCTL_VOLUME_IS_OFFLINE:
        return "IOCTL_VOLUME_IS_OFFLINE";
    case IOCTL_VOLUME_IS_IO_CAPABLE:
        return "IOCTL_VOLUME_IS_IO_CAPABLE";
    case IOCTL_VOLUME_QUERY_FAILOVER_SET:
        return "IOCTL_VOLUME_QUERY_FAILOVER_SET";
    case IOCTL_VOLUME_QUERY_VOLUME_NUMBER:
        return "IOCTL_VOLUME_QUERY_VOLUME_NUMBER";
    case IOCTL_VOLUME_LOGICAL_TO_PHYSICAL:
        return "IOCTL_VOLUME_LOGICAL_TO_PHYSICAL";
    case IOCTL_VOLUME_PHYSICAL_TO_LOGICAL:
        return "IOCTL_VOLUME_PHYSICAL_TO_LOGICAL";
    case IOCTL_VOLUME_IS_PARTITION:
        return "IOCTL_VOLUME_IS_PARTITION";
    case IOCTL_VOLUME_READ_PLEX:
        return "IOCTL_VOLUME_READ_PLEX";
    case IOCTL_VOLUME_SET_GPT_ATTRIBUTES:
        return "IOCTL_VOLUME_SET_GPT_ATTRIBUTES";
    case IOCTL_VOLUME_GET_GPT_ATTRIBUTES:
        return "IOCTL_VOLUME_GET_GPT_ATTRIBUTES";
    case IOCTL_INTERNAL_PARALLEL_PORT_ALLOCATE:
        return "IOCTL_INTERNAL_PARALLEL_PORT_ALLOCATE";
    case IOCTL_INTERNAL_GET_PARALLEL_PORT_INFO:
        return "IOCTL_INTERNAL_GET_PARALLEL_PORT_INFO";
    case IOCTL_INTERNAL_PARALLEL_CONNECT_INTERRUPT:
        return "IOCTL_INTERNAL_PARALLEL_CONNECT_INTERRUPT";
    case IOCTL_INTERNAL_PARALLEL_DISCONNECT_INTERRUPT:
        return "IOCTL_INTERNAL_PARALLEL_DISCONNECT_INTERRUPT";
    case IOCTL_INTERNAL_RELEASE_PARALLEL_PORT_INFO:
        return "IOCTL_INTERNAL_RELEASE_PARALLEL_PORT_INFO";
    case IOCTL_INTERNAL_GET_MORE_PARALLEL_PORT_INFO:
        return "IOCTL_INTERNAL_GET_MORE_PARALLEL_PORT_INFO";
    case IOCTL_INTERNAL_PARCHIP_CONNECT:
        return "IOCTL_INTERNAL_PARCHIP_CONNECT";
    case IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE:
        return "IOCTL_INTERNAL_PARALLEL_SET_CHIP_MODE";
    case IOCTL_INTERNAL_PARALLEL_CLEAR_CHIP_MODE:
        return "IOCTL_INTERNAL_PARALLEL_CLEAR_CHIP_MODE";
    case IOCTL_INTERNAL_GET_PARALLEL_PNP_INFO:
        return "IOCTL_INTERNAL_GET_PARALLEL_PNP_INFO";
    case IOCTL_INTERNAL_INIT_1284_3_BUS:
        return "IOCTL_INTERNAL_INIT_1284_3_BUS";
    case IOCTL_INTERNAL_SELECT_DEVICE:
        return "IOCTL_INTERNAL_SELECT_DEVICE";
    case IOCTL_INTERNAL_DESELECT_DEVICE:
        return "IOCTL_INTERNAL_DESELECT_DEVICE";
    case IOCTL_INTERNAL_GET_PARPORT_FDO:
        return "IOCTL_INTERNAL_GET_PARPORT_FDO";
    case IOCTL_INTERNAL_PARCLASS_CONNECT:
        return "IOCTL_INTERNAL_PARCLASS_CONNECT";
    case IOCTL_INTERNAL_PARCLASS_DISCONNECT:
        return "IOCTL_INTERNAL_PARCLASS_DISCONNECT";
    case IOCTL_INTERNAL_DISCONNECT_IDLE:
        return "IOCTL_INTERNAL_DISCONNECT_IDLE";
    case IOCTL_INTERNAL_LOCK_PORT:
        return "IOCTL_INTERNAL_LOCK_PORT";
    case IOCTL_INTERNAL_UNLOCK_PORT:
        return "IOCTL_INTERNAL_UNLOCK_PORT";
    case IOCTL_INTERNAL_PARALLEL_PORT_FREE:
        return "IOCTL_INTERNAL_PARALLEL_PORT_FREE";
    case IOCTL_INTERNAL_PARDOT3_CONNECT:
        return "IOCTL_INTERNAL_PARDOT3_CONNECT";
    case IOCTL_INTERNAL_PARDOT3_DISCONNECT:
        return "IOCTL_INTERNAL_PARDOT3_DISCONNECT";
    case IOCTL_INTERNAL_PARDOT3_RESET:
        return "IOCTL_INTERNAL_PARDOT3_RESET";
    case IOCTL_INTERNAL_PARDOT3_SIGNAL:
        return "IOCTL_INTERNAL_PARDOT3_SIGNAL";
    case IOCTL_INTERNAL_REGISTER_FOR_REMOVAL_RELATIONS:
        return "IOCTL_INTERNAL_REGISTER_FOR_REMOVAL_RELATIONS";
    case IOCTL_INTERNAL_UNREGISTER_FOR_REMOVAL_RELATIONS:
        return "IOCTL_INTERNAL_UNREGISTER_FOR_REMOVAL_RELATIONS";
    case IOCTL_INTERNAL_LOCK_PORT_NO_SELECT:
        return "IOCTL_INTERNAL_LOCK_PORT_NO_SELECT";
    case IOCTL_INTERNAL_UNLOCK_PORT_NO_DESELECT:
        return "IOCTL_INTERNAL_UNLOCK_PORT_NO_DESELECT";
    case IOCTL_INTERNAL_DISABLE_END_OF_CHAIN_BUS_RESCAN:
        return "IOCTL_INTERNAL_DISABLE_END_OF_CHAIN_BUS_RESCAN";
    case IOCTL_INTERNAL_ENABLE_END_OF_CHAIN_BUS_RESCAN:
        return "IOCTL_INTERNAL_ENABLE_END_OF_CHAIN_BUS_RESCAN";
    case IOCTL_SCSISCAN_CMD		:
        return "IOCTL_SCSISCAN_CMD		";
    case IOCTL_SCSISCAN_LOCKDEVICE:
        return "IOCTL_SCSISCAN_LOCKDEVICE";
    case IOCTL_SCSISCAN_UNLOCKDEVICE:
        return "IOCTL_SCSISCAN_UNLOCKDEVICE";
    case IOCTL_SCSISCAN_SET_TIMEOUT:
        return "IOCTL_SCSISCAN_SET_TIMEOUT";
    case IOCTL_SCSISCAN_GET_INFO:
        return "IOCTL_SCSISCAN_GET_INFO";
    case IOCTL_SWENUM_INSTALL_INTERFACE:
        return "IOCTL_SWENUM_INSTALL_INTERFACE";
    case IOCTL_SWENUM_REMOVE_INTERFACE:
        return "IOCTL_SWENUM_REMOVE_INTERFACE";
    case IOCTL_SWENUM_GET_BUS_ID:
        return "IOCTL_SWENUM_GET_BUS_ID";
    case IOCTL_INTERNAL_USB_SUBMIT_URB:
        return "IOCTL_INTERNAL_USB_SUBMIT_URB";
    case IOCTL_INTERNAL_USB_RESET_PORT:
        return "IOCTL_INTERNAL_USB_RESET_PORT";
    case IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO:
        return "IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO";
    case IOCTL_INTERNAL_USB_GET_PORT_STATUS:
        return "IOCTL_INTERNAL_USB_GET_PORT_STATUS";
    case IOCTL_INTERNAL_USB_ENABLE_PORT:
        return "IOCTL_INTERNAL_USB_ENABLE_PORT";
    case IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION:
        return "IOCTL_INTERNAL_USB_SUBMIT_IDLE_NOTIFICATION";
    case IOCTL_INTERNAL_USB_GET_HUB_COUNT:
        return "IOCTL_INTERNAL_USB_GET_HUB_COUNT";
    case IOCTL_INTERNAL_USB_CYCLE_PORT:
        return "IOCTL_INTERNAL_USB_CYCLE_PORT";
    case IOCTL_INTERNAL_USB_GET_HUB_NAME:
        return "IOCTL_INTERNAL_USB_GET_HUB_NAME";
    case IOCTL_INTERNAL_USB_GET_BUS_INFO:
        return "IOCTL_INTERNAL_USB_GET_BUS_INFO";
    case IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME:
        return "IOCTL_INTERNAL_USB_GET_CONTROLLER_NAME";
    case IOCTL_INTERNAL_USB_GET_BUSGUID_INFO:
        return "IOCTL_INTERNAL_USB_GET_BUSGUID_INFO";
    case IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO:
        return "IOCTL_INTERNAL_USB_GET_PARENT_HUB_INFO";
    case IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE:
        return "IOCTL_INTERNAL_USB_GET_DEVICE_HANDLE";
    case IOCTL_USB_HCD_GET_STATS_1:
        return "IOCTL_USB_HCD_GET_STATS_1";
    case IOCTL_USB_HCD_DISABLE_PORT:
        return "IOCTL_USB_HCD_DISABLE_PORT";
    case IOCTL_USB_HCD_ENABLE_PORT:
        return "IOCTL_USB_HCD_ENABLE_PORT";
    case IOCTL_USB_GET_NODE_INFORMATION:
        return "IOCTL_USB_GET_NODE_INFORMATION";
    case IOCTL_USB_GET_NODE_CONNECTION_INFORMATION:
        return "IOCTL_USB_GET_NODE_CONNECTION_INFORMATION";
    case IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES:
        return "IOCTL_USB_GET_NODE_CONNECTION_ATTRIBUTES";
    case IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION:
        return "IOCTL_USB_GET_DESCRIPTOR_FROM_NODE_CONNECTION";
    case IOCTL_USB_GET_NODE_CONNECTION_NAME:
        return "IOCTL_USB_GET_NODE_CONNECTION_NAME";
    case IOCTL_USB_DIAG_IGNORE_HUBS_ON:
        return "IOCTL_USB_DIAG_IGNORE_HUBS_ON";
    case IOCTL_USB_DIAG_IGNORE_HUBS_OFF:
        return "IOCTL_USB_DIAG_IGNORE_HUBS_OFF";
    case IOCTL_USB_GET_HUB_CAPABILITIES:
        return "IOCTL_USB_GET_HUB_CAPABILITIES";
    case IOCTL_USB_HUB_CYCLE_PORT	:
        return "IOCTL_USB_HUB_CYCLE_PORT	";
    case IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX:
        return "IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX";
    case IOCTL_GET_VERSION:
        return "IOCTL_GET_VERSION";
    case IOCTL_CANCEL_IO:
        return "IOCTL_CANCEL_IO";
    case IOCTL_WAIT_ON_DEVICE_EVENT:
        return "IOCTL_WAIT_ON_DEVICE_EVENT";
    case IOCTL_READ_REGISTERS:
        return "IOCTL_READ_REGISTERS";
    case IOCTL_WRITE_REGISTERS:
        return "IOCTL_WRITE_REGISTERS";
    case IOCTL_GET_CHANNEL_ALIGN_RQST:
        return "IOCTL_GET_CHANNEL_ALIGN_RQST";
    case IOCTL_GET_DEVICE_DESCRIPTOR:
        return "IOCTL_GET_DEVICE_DESCRIPTOR";
    case IOCTL_RESET_PIPE:
        return "IOCTL_RESET_PIPE";
    case IOCTL_GET_USB_DESCRIPTOR:
        return "IOCTL_GET_USB_DESCRIPTOR";
    case IOCTL_SEND_USB_REQUEST:
        return "IOCTL_SEND_USB_REQUEST";
    case IOCTL_GET_PIPE_CONFIGURATION:
        return "IOCTL_GET_PIPE_CONFIGURATION";
    case IOCTL_SET_TIMEOUT:
        return "IOCTL_SET_TIMEOUT";
	default:
		return NULL;
	}
}

void BazisLib::DDK::DumpDeviceControlCode(const char *pszFormat, ULONG Code)
{
	char szCode[512];
	const char *pszCode = MapDeviceControlCode(Code);
	if (!pszCode)
	{
		sprintf(szCode, "[%08X; (devtype=%04X; code=%03X)]", Code, DEVICE_TYPE_FROM_CTL_CODE(Code), (Code >> 2) & 0x7FF);
		pszCode = szCode;
	}
	DbgPrint(pszFormat, pszCode);
}

void BazisLib::DDK::DumpBinaryBuffer(const void *pBuffer, int Size)
{
	const int BytesPerLine = 20;
	for (int i = 0; i < Size; i++)
	{
		DbgPrint("%02X ", ((unsigned char *)pBuffer)[i]);
		if (!((i + 1) % BytesPerLine))
			DbgPrint("\n");
	}
}

void BazisLib::DDK::DumpInt32Buffer(const void *pBuffer, int Size)
{
	const int BytesPerLine = 20;
	for (int i = 0; i < (Size / 4); i++)
	{
		DbgPrint("%d ", ((int *)pBuffer)[i]);
		if (!((i + 1) % BytesPerLine))
			DbgPrint("\n");
	}
}

#endif
#endif